#ifndef __GLOBALS_H__
#define __GLOBALS_H__

#include "unp.h"
#include "unpifiplus.h"

#define log_msg(message) printf("[debug print]>>[%s(%d)] %s\n" , __FILE__,\
        __LINE__, message)

#define log_msg_int(message, val) printf("[debug print]>>[%s(%d)] %s:%d\n" ,\
        __FILE__, __LINE__, message, val)

#define log_msg_int_int(message, val1, val2) printf("[debug print]>>[%s(%d)] %s:%d %d\n",\
        __FILE__, __LINE__, message, val1, val2)

#define TRUE 1
#define TMP_BUFSIZE 100
#define SRV_LOG "\n[SERVER_LOG]"
#define CLI_LOG "\n[CLIENT_LOG]"

/**
TODO: Description
  */
struct sock_ele
{
	int sockfd;
	char ip_addr[INET_ADDRSTRLEN+5];
	char net_mask[INET_ADDRSTRLEN];
	char sub_mask[INET_ADDRSTRLEN];
};

struct packet
{
	uint32_t seqno;
	uint32_t ackno;
	uint32_t win;
	char data[TMP_BUFSIZE];

};

void parse_server_in(int *server_port, int *win);
void sig_chld(int);
void get_subnet_mask(char ip_addr[], char net_mask[], char sub_mask[]);
void parse_client_in(char ip_server[], int * server_port, char filename[], int*\
        Win, int * seed, float * p, int * mu);
struct packet get_packet(struct packet p, char buf[TMP_BUFSIZE], uint32_t  win);
#endif
 
